package com.rabbit.eap.controller.monitor;

import com.rabbit.eap.framework.common.api.ApiResult;
import com.rabbit.eap.framework.common.controller.BaseController;
import com.rabbit.eap.framework.core.pagination.Paging;
import com.rabbit.eap.framework.log.annotation.Module;
import com.rabbit.eap.framework.log.annotation.OperationLog;
import com.rabbit.eap.framework.log.entity.SysOperationLog;
import com.rabbit.eap.framework.log.enums.OperationLogType;
import com.rabbit.eap.framework.log.param.SysOperationLogPageParam;
import com.rabbit.eap.framework.log.service.ISysOperationLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @projectName eap
 * @packageName com.rabbit.eap.controller.monitor
 * @className SysOperationLogController
 * @author： rabbit
 * @version： 1.0
 * @since： 2020/4/26 16:29
 * <p>Description: SysOperationLogController </p>

 */
@Slf4j
@RestController
@RequestMapping("/monitor/sysOperationLog")
@Module("monitor")
@Api(value = "系统操作日志API", tags = {"系统操作日志"})
public class SysOperationLogController extends BaseController {
    @Autowired
    private ISysOperationLogService sysOperationLogService;

    /**
     * 系统操作日志分页列表
     */
    @GetMapping("/getSysOperationLogPageList")
    @RequiresPermissions("log:operationLog:list")
    @ApiOperation(value = "系统操作日志分页列表", response = SysOperationLog.class)
    @OperationLog(name = "系统登录日志分页列表", type = OperationLogType.PAGE)
    public ApiResult<Paging<SysOperationLog>> getSysOperationLogPageList(SysOperationLogPageParam sysOperationLogPageParam) throws Exception {
        Paging<SysOperationLog> paging = sysOperationLogService.getSysOperationLogPageList(sysOperationLogPageParam);
        return ApiResult.ok(paging);
    }
}
